package com.cg.mapper;

import com.cg.entity.CrawlerJob;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface CrawlerJavaMapper {

    @Insert({
            "<script>",
            "INSERT INTO ${table} (job_title, salary, city, district, experience, education, company, company_field, company_type, company_size, company_detail_url, job_detail_url)",
            "VALUES (",
            "COALESCE(#{item.jobTitle}, ''),",
            "COALESCE(#{item.salary}, ''),",
            "COALESCE(#{item.city}, ''),",
            "COALESCE(#{item.district}, ''),",
            "COALESCE(#{item.experience}, ''),",
            "COALESCE(#{item.education}, ''),",
            "COALESCE(#{item.company}, ''),",
            "COALESCE(#{item.companyField}, ''),",
            "COALESCE(#{item.companyType}, ''),",
            "COALESCE(#{item.companySize}, ''),",
            "COALESCE(#{item.companyDetailUrl}, ''),",
            "COALESCE(#{item.jobDetailUrl}, '')",
            ")",
            "</script>"
    })
    void insert(@Param("table") String table, @Param("item") CrawlerJob item);
}


